#!/bin/bash
echo "build docker image"

IMAGE_REPOSITORY=registry.cn-shanghai.aliyuncs.com/leizi_aliyun
IMAGE_NAME=my-demo

docker rmi ${IMAGE_NAME}
docker rm -f ${IMAGE_NAME}
docker build -t $IMAGE_REPOSITORY/$IMAGE_NAME .
docker save -o /tmp/$IMAGE_NAME.tar $IMAGE_REPOSITORY/$IMAGE_NAME:latest
docker images | grep ${IMAGE_NAME} | awk '{print $3}' | xargs docker run -p 19333:19333 --name $IMAGE_NAME -itd
